<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%--
  Created by IntelliJ IDEA.
  User: 武露斌
  Date: 2021/11/1
  Time: 10:52
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
    <script src="../../js/jquery-1.8.2.min.js"></script>
    <link rel="stylesheet" href="../../css/css.css">
</head>
<body>

<form action="list.do" method="post">
    <input type="hidden" name="pageNum">
    职业资格证书编号：<input type="text" name="zyid" value="${param.zyid}">
    有效期<input type="text" name="sta" value="${param.sta}">--<input type="text" name="ends" value="${param.ends}">
    <input type="submit" value="查询">
    <input type="button" value="刷新" onclick="sx()">
</form>

<table border="1">
    <tr>
        <td>

        </td>
        <td>编号</td>
        <td>姓名</td>
        <td>性别</td>
        <td>地址</td>
        <td>申请注册单位</td>
        <td>会计师分类编号</td>
        <td>职业资格证编号</td>
        <td>注册号</td>
        <td>有效期</td>

    </tr>
    <c:forEach items="${pageInfo.list}" var="a">
        <tr>
            <td>
                <input type="checkbox" value="${a.aid}" name="aa">
            </td>
            <td>${a.aid}</td>
            <td>${a.aname}</td>
            <td>${a.sex}</td>
            <td>${a.sheng}</td>
            <td>${a.zcdw}</td>
            <td>${a.tid}</td>
            <td>${a.zyid}</td>
            <td>${a.zch}</td>
            <td>${a.yxdate}</td>
        </tr>
    </c:forEach>

    <tr>
       <td colspan="20">

           <input type="button" value="添加" onclick="add()">
           <input type="button" value="全选" onclick="qx()">

           <input type="button" value="批量删除" onclick="dels()">

           第${pageInfo.pageNum}/${pageInfo.pages}页
           <input type="button" value="首页" onclick="fy(1)">
           <input type="button" value="上一页" onclick="fy(${pageInfo.isFirstPage?1:pageInfo.prePage})">

           <c:forEach items="${pageInfo.navigatepageNums}" var="index">
               <input type="button" value="${index}" onclick="fy(${index})">
           </c:forEach>

           <input type="button" value="下一页" onclick="fy(${pageInfo.isLastPage?pageInfo.pages:pageInfo.nextPage})">
           <input type="button" value="尾页" onclick="fy(${pageInfo.pages})">
       </td>
    </tr>
</table>


</body>
</html>
<script>
    function qx() {
        $("[name='aa']").prop("checked",true)
    }

    function dels() {
       var aids=$("[name='aa']:checked").map(function () {
            return $(this).val()
        }).get().toString()


        if(confirm("确认要删除"+aids+"吗？")){
            $.post(
                "dels.do",
                {"aids":aids},
                function (data) {
                    if (data>0){
                        alert("删除成功")
                        location="list.do"
                    }else{
                        alert("删除失败")
                    }
                }
            )
        }else{
            alert("已经取消")
        }
    }

    function fy(pageNum) {
        $("[name='pageNum']").val(pageNum)
        $("form").submit();
    }
    function sx() {
        location="list.do"
    }

    function add() {
        location="addto.do"
    }
</script>
